import 'package:flutter/material.dart';

import '../main.dart';

class HomePage extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    // TODO: implement createState
    return _HomePageState();
  }
}

class _HomePageState extends State<HomePage> {
  @override
  void dispose() {
    print('dispose HomePage');
    // TODO: implement dispose
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    // TODO: implement build
    return Scaffold(
      appBar: AppBar(
        title: Text('Home'),
      ),
      body: Container(
        margin: EdgeInsets.only(top: 50.0),
        alignment: Alignment.center,
        child: Column(
          children: <Widget>[
            Text('Welcom To App!'),
            FlatButton(
              child: Text('Logout'),
              onPressed: () {
                appAuth.logout().then(
                  (_) => Navigator.of(context).pushNamedAndRemoveUntil('/login', (Route<dynamic> route) => false)
                );
              },
            )
          ],
        ),
      ),
    );
  }
}